
#ifndef SX_POSITION_2D_H
#define SX_POSITION_2D_H

namespace Sx {
namespace Graphics {

/* 
 * The Position2D class provides a simple data-structure for defining a 2D
 * point in space (Cartesian coordinates).
 */
template <typename Real>
class Position2D {
public:
	Position2D();
	Position2D(Real x, Real y);
	virtual ~Position2D();

	void setX(Real x);
	void setY(Real y);
	void setValues(Real x, Real y);

	Real getX() const;
	Real getY() const;

	Real& x();
	Real& y();

protected:
	Real posX, posY;
};

template <typename Real>
Position2D<Real>::Position2D() {
	this->posX = 0;
	this->posY = 0;
}

template <typename Real>
Position2D<Real>::Position2D(Real x, Real y) {
	this->posX = x;
	this->posY = y;
}

template <typename Real>
Position2D<Real>::~Position2D() {}

template <typename Real>
void Position2D<Real>::setX(Real x) {
	this->posX = x;
}

template <typename Real>
void Position2D<Real>::setY(Real y) {
	this->posY = y;
}

template <typename Real>
void Position2D<Real>::setValues(Real x, Real y) {
	this->posX = x;
	this->posY = y;
}

template <typename Real>
Real Position2D<Real>::getX() const {
	return this->posX;
}

template <typename Real>
Real Position2D<Real>::getY() const {
	return this->posY;
}

template <typename Real>
Real& Position2D<Real>::x() {
	return this->posX;
}

template <typename Real>
Real& Position2D<Real>::y() {
	return this->posY;
}

typedef Position2D<short> Position2Ds;
typedef Position2D<unsigned short> Position2Dus;
typedef Position2D<int> Position2Di;
typedef Position2D<unsigned int> Position2Dui;
typedef Position2D<float> Position2Df;
typedef Position2D<double> Position2Dd;
typedef Position2D<long> Position2Dl;

}

}

#endif
